#!/bin/bash
webhook='https://oapi.dingtalk.com/robot/send?access_token=你的token';
last_ip=$(cat /tmp/ip.txt)
this_ip=$(curl ip.sb) >/dev/null 2>&1;
#echo t$this_ip;
#echo l$last_ip;
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin;
if [ "$this_ip"x != "$last_ip"x ];
then
echo update;
echo $this_ip >/tmp/ip.txt
curl $webhook \
-H 'Content-Type:application/json' \
-X POST \
-d "{
\"msgtype\":\"text\",\
\"text\":{\
        \"content\":\"提示信息\nip:$this_ip\"\
}\
}";
fi;